package com.demo.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertySources;

public class PropertyPlaceholderConfiguration {

    /**
     * 属性源占位符适配器
     * 配合@Value注解使用，解释${...}点位符，然后从Spring容器的{@link Environment} 和它的 {@link PropertySources} 集合中查找属性值，并注入到带有@Value注解的成员变量。.
     * @return {@link PropertySourcesPlaceholderConfigurer}
     */
    @Bean
    public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}
